package com.bdtop.dbl.server.request;

import com.bdtop.dbl.server.response.BaseResponse;
import com.bdtop.dbl.thirdparty.asynchttp.HttpPostRequest;
import com.bdtop.dbl.thirdparty.asynchttp.RequestCallback;
import com.bdtop.dbl.utils.Constants;
import com.bdtop.dbl.utils.DBLDebug;
import com.google.gson.Gson;

/**
 * 
  * @ClassName: UpdatePasswordRequest
  * @Description: TODO
  * @author: liyongqiang
  * @date:2014-10-29
 */
public class UpdatePasswordRequest extends HttpPostRequest {

    /**
     * @param callback
     */
    public UpdatePasswordRequest(RequestCallback callback) {
        super(callback);
        getRequestParams().add(Constants.COMMAND, Constants.CMD_MODI_PASS);
    }

    public void setParams(String sign, String password,String srcpw) {
        getRequestParams().add(Constants.PARAM_LOGIN_SIGN, sign);
        getRequestParams().add(Constants.PARAM_PWD, password);
        getRequestParams().add(Constants.PARAM_SRCPW, srcpw);
        

    }

    @Override
    public Object parse(String responseString) {
        DBLDebug.logd("UpdatePasswordRequest response = " + responseString);

        Gson gson = new Gson();
        BaseResponse response = gson.fromJson(responseString, BaseResponse.class);

        return response;
    }

    @Override
    protected String getUrl() {
        return Constants.SERVER_ADDRESS;
    }

}
